package pub.tbc.atps.task;

import pub.tbc.toolkit.Objs;

/**
 * Created by tbc on 2016/12/1.
 */
public enum HttpMethod {
    GET, POST, DELETE, PUT;

    public static HttpMethod getHttpMethod(String method) {
        if (Objs.isEmpty(method))
            throw new RuntimeException("http method 不能为空");
        switch (method.toLowerCase()) {
            case "get":
                return GET;
            case "post":
                return POST;
            case "delete":
                return DELETE;
            case "put":
                return PUT;
            default:
                throw new RuntimeException("不受支持的http method：仅支持GET/POST/DELETE/PUT方法");
        }
    }
}
